<link rel="stylesheet" href="/opebs/css/bootstrap.min.css">
<link rel="stylesheet" href="/opebs/date/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/opebs/css/bootstrap-select.css">
<script src="/opebs/js/jquery.min.js"></script>
<script src="/opebs/js/bootstrap.min.js"></script>
<script src="/opebs/js/bootstrap-select.js"></script>
<script src="/lib/jquery.form.js"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>

<link rel="stylesheet" href="/opebs/date/css/bootstrap-datetimepicker.min.css">
<script src="/opebs/date/js/bootstrap-datetimepicker.min.js"></script>

 <link href="/new-city-picker/css/city-picker.css" rel="stylesheet">
    <link href="/new-city-picker/css/main.css" rel="stylesheet">
<script src="/new-city-picker/js/city-picker.data.js"></script>
<script src="/new-city-picker/js/city-picker.js"></script>
<script src="/new-city-picker/js/main.js"></script>

<#include "/common/h-ui-base-css.html">
<#include "/common/validation-js.html">
<body>
    <div class="page-container">
        <form action="" method="post" class="form form-horizontal" id="form-project-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目编号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="${project.proId!}" id="proId" name="proId" style="background-color: #8eaf84" placeholder=""  readonly>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proName"  id="proName" value="${project.proName!}"  >
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目类别：</label>
                <div class="formControls col-xs-8 col-sm-9">
                        <select name="proCategory" class="selectpicker form-control" data-live-search="true" id="proCategory">
                             <option>请选择</option>
                            <#if category??>
                                <#list category as list>
                                    <option value="${list.key}" <#if project.proCategory??><#if list.key==project.proCategory>selected</#if></#if>>${list.text}</option>
                                </#list>
                            </#if>
                        </select>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompany" id="proCompany" value="${project.proCompany!}"  >
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>地点：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompanyLocation" id="proCompanyLocation"  value="${project.proCompanyLocation!}"  >
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司性质：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompanyNature" id="proCompanyNature"  value="${project.proCompanyNature!}"  >
                </div>
            </div>
            <#--<div class="row cl">-->
                <#--<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司性质：</label>-->
                <#--<div class="formControls col-xs-8 col-sm-9">-->
                    <#--<span class="select-box">-->
                        <#--<select name="proCompanyNature" class="select" id="proCompanyNature">-->
                             <#--<option>请选择</option>-->
                            <#--<#if nature??>-->
                                <#--<#list nature as list>-->
                                    <#--<option value="${list.constantValueDesc}" <#if project.proCompanyNature??><#if list.constantValueDesc==project.proCompanyNature>selected</#if></#if>>${list.constantValueDesc}</option>-->
                                <#--</#list>-->
                            <#--</#if>-->
                        <#--</select>-->
                    <#--</span>-->
                <#--</div>-->
            <#--</div>-->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司情况：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompanyCondition" id="proCompanyCondition" value="${project.proCompanyCondition!}"  >
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司需求：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompanyRequire"  id="proCompanyRequire"  value="${project.proCompanyRequire!}"  >
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公司主营：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="proCompanyMain" id="proCompanyMain" value="${project.proCompanyMain!}"  >
                </div>
            </div>

            <#--<div class="row cl">-->
                <#--<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目所在地：</label>-->
                <#--<div class="formControls col-xs-8 col-sm-9">-->
                    <#--<div style="position: relative;">-->
                        <#--<input class="form-control" readonly type="text" id="city" name="city" value="${city}" data-toggle="city-picker" data-level="city" placeholder="请选择省/市">-->
                    <#--</div>-->
                <#--</div>-->
            <#--</div>-->

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">项目进度：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="${project.proLabel!}" name="proLabel" id="proLabel">
                </div>
            </div>

            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button  class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                </div>
            </div>
            <input type="text" hidden id="proRukuFlag" name="proRukuFlag" value="1">
        </form>
    </div>
</body>


<script type="text/javascript">
    $(function(){
        $("#proApprovalTime").datetimepicker({
            format:'yyyy-mm-dd',  //格式  如果只有yyyy-mm-dd那就是0000-00-00
            autoclose:true,//选择后是否自动关闭
            minView:2,//最精准的时间选择为日期  0-分 1-时 2-日 3-月
            language:  'zh-CN', //中文
            weekStart: 1, //一周从星期几开始
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            // daysOfWeekDisabled:"1,2,3", //一周的周几不能选 格式为"1,2,3"  数组格式也行
            todayBtn : true,  //在底部是否显示今天
            todayHighlight :true, //今天是否高亮显示
            keyboardNavigation:true, //方向图标改变日期  必须要有img文件夹 里面存放图标
            showMeridian:false,  //是否出现 上下午
            initialDate:new Date()
            //startDate: "2017-01-01" //日期开始时间 也可以是new Date()只能选择以后的时间
        }).on("changeDate",function(){
            var start = $("#start").val();
        });

    });
</script>

<script type="text/javascript">
    $("#form-project-add").validate({
        rules:{
            proManager:{
                required:true
            },
            proApprovalTime:{
                required:true,
            }
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var id = ${project.id!}
            $(form).ajaxSubmit({
                type: 'post',
                url: "/project-ins-upd-del/"+id ,
                data :$("form-project-add").serialize(),
                async:false,
                success: function(data){
                    layer.msg('添加成功!',{icon:1,time:1000});
                },
                error: function(XmlHttpRequest, textStatus, errorThrown){
                    layer.msg('error!',{icon:1,time:1000});
                }
            });
            var index = parent.layer.getFrameIndex(window.name);
            var refreshFlag = ${refreshFlag!}
            if(refreshFlag == 0) {
                var handler = '/project-list/0/1/20';
                parent.$('#project_table').datagrid('options').url = handler;
                parent.$('#project_table').datagrid('reload');
            }else if(refreshFlag == 1){
                parent.location.reload();
            }
            parent.layer.close(index);
        }
    });
</script>
